home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / misc / edu / Calgor.lha / Cal / Algorithms / switch.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-19  |  1.3 KB  |  49 lines

  1. #include<hold/anim.h>
  2.  
  3. /* 000 */ void switch_control(void){
  4. /* 001 */ int guard = 0;
  5.  
  6.           a_func("switch_control",0);
  7.           a_intini(guard,"guard",1);
  8.           a_intcomp("guard!=6",2);
  9. /* 002 */   while(guard!=6){
  10.               a_show(3);
  11. /* 003 */     switch(guard){
  12. /* 004 */       case 3 : case 4 :
  13.                   a_show(4);
  14. /* 005 */         guard = 5;
  15.                   a_intass("guard","5",5);
  16.                   a_show(6);
  17. /* 006 */         break;
  18. /* 007 */       case 2 :
  19.                   a_show(7);
  20. /* 008 */         guard = 4;
  21.                   a_intass("guard","4",8);
  22.                   a_show(9);
  23. /* 009 */         break;
  24. /* 010 */       case 1 :
  25.                   a_show(10);
  26. /* 011 */         guard = 2;
  27.                   a_intass("guard","2",11);
  28.                   a_show(12);
  29. /* 012 */         break;
  30. /* 013 */       case 0 :
  31.                   a_show(13);
  32. /* 014 */         guard = 1;
  33.                   a_intass("guard","1",14);
  34.                   a_show(15);
  35. /* 015 */         break;
  36. /* 016 */       default :
  37.                   a_show(16);
  38. /* 017 */         guard = 6;
  39.                   a_intass("guard","6",17);
  40.                   a_show(18);
  41. /* 018 */         break;
  42. /* 019 */     }
  43.             a_intcomp("guard!=6",2);
  44. /* 020 */   }
  45.             a_show(20);
  46.             a_endfunc("switch_control",21);
  47. /* 021 */ }
  48.  
  49.